Make vm-top and the xenstat perl and python bindings conditional based on configurati...
authorjosht@us.ibm.com <josht@us.ibm.com>
Sat, 13 Aug 2005 00:44:00 +0000 (00:44 +0000)
committerjosht@us.ibm.com <josht@us.ibm.com>
Sat, 13 Aug 2005 00:44:00 +0000 (00:44 +0000)
Config.mk
tools/xenstat/libxenstat/Makefile
tools/xenstat/vm-top/Makefile

index 2eb5eae86fb055720dca56261af8ca91b3140837..7991af7b2c94fe65d53df1c549ebcb259049d855 100644 (file)
--- a/Config.mk
+++ b/Config.mk
@@ -35,3 +35,8 @@ CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
 
 # Choose the best mirror to download linux kernel
 KERNEL_REPO = http://www.kernel.org
+
+# Optional components
+XENSTAT_PERL_BINDINGS   ?= n
+XENSTAT_PYTHON_BINDINGS ?= y
+XENSTAT_VM_TOP          ?= y
index 98b16c3e7f30adf98b9111463d593464ddf9d0bf..d1dee3bd86bab0f1956f74e3e4b5f12e935cefd6 100644 (file)
@@ -42,8 +42,6 @@ CFLAGS+=-I$(XEN_ROOT)/xen/include/public
 CFLAGS+=-I$(LINUX_ROOT)/include/asm-xen/linux-public/
 LDFLAGS+=-Lsrc
 
-# Note that the bindings are not built by default, because they require a
-# number of external dependencies.
 all: $(LIB) $(LINKS)
 
 $(LIB): $(OBJECTS)
@@ -81,12 +79,16 @@ BINDINGS=$(PYLIB) $(PYMOD) $(PERLLIB) $(PERLMOD)
 BINDINGSRC=$(PYSRC) $(PERLSRC)
 
 # The all-bindings target builds all the language bindings
-all-bindings: $(BINDINGS)
+all-bindings: perl-bindings python-bindings
+
+# The install-bindings target installs all the language bindings
+install-bindings: install-perl-bindings install-python-bindings
 
 $(BINDINGS): $(LIB) $(LINKS) src/xenstat.h
 
 SWIG_FLAGS=-module xenstat -Isrc
 
+# Python bindings
 PYTHON_VERSION=2.3
 PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION) -lpython$(PYTHON_VERSION)
 $(PYSRC) $(PYMOD): bindings/swig/xenstat.i
@@ -95,6 +97,19 @@ $(PYSRC) $(PYMOD): bindings/swig/xenstat.i
 $(PYLIB): $(PYSRC)
        $(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) -shared -lxenstat -o $@ $<
 
+python-bindings: $(PYLIB) $(PYMOD)
+
+pythonlibdir=$(prefix)/lib/python$(PYTHON_VERSION)/site-packages
+install-python-bindings: $(PYLIB) $(PYMOD)
+       $(INSTALL_PROG) $(PYLIB) $(DESTDIR)$(pythonlibdir)/_xenstat.so
+       $(INSTALL_PROG) $(PYMOD) $(DESTDIR)$(pythonlibdir)/xenstat.py
+
+ifeq ($(XENSTAT_PYTHON_BINDINGS),y)
+all: python-bindings
+install: install-python-bindings
+endif
+
+# Perl bindings
 PERL_FLAGS=`perl -MConfig -e 'print "$$Config{ccflags} -I$$Config{archlib}/CORE";'`
 $(PERLSRC) $(PERLMOD): bindings/swig/xenstat.i
        swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<
@@ -102,19 +117,18 @@ $(PERLSRC) $(PERLMOD): bindings/swig/xenstat.i
 $(PERLLIB): $(PERLSRC)
        $(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) -shared -lxenstat -o $@ $<
 
-# The install-bindings target installs all the language bindings
-install-bindings: install-perl-bindings install-python-bindings
+perl-bindings: $(PERLLIB) $(PERLMOD)
 
-pythonlibdir=$(prefix)/lib/python$(PYTHON_VERSION)/site-packages
-install-python-bindings: $(PYLIB) $(PYMOD)
-       $(INSTALL_PROG) $(PYLIB) $(pythonlibdir)/_xenstat.so
-       $(INSTALL_PROG) $(PYMOD) $(pythonlibdir)/xenstat.py
-
-perllibdir=$(prefix)/lib/site_perl
-perlmoddir=$(prefix)/lib/site_perl
+perllibdir=$(prefix)/lib/perl5
+perlmoddir=$(prefix)/share/perl5
 install-perl-bindings: $(PERLLIB) $(PERLMOD)
-       $(INSTALL_PROG) $(PERLLIB) $(perllibdir)/xenstat.so
-       $(INSTALL_PROG) $(PERLMOD) $(perlmoddir)/xenstat.pm
+       $(INSTALL_PROG) $(PERLLIB) $(DESTDIR)$(perllibdir)/xenstat.so
+       $(INSTALL_PROG) $(PERLMOD) $(DESTDIR)$(perlmoddir)/xenstat.pm
+
+ifeq ($(XENSTAT_PERL_BINDINGS),y)
+all: perl-bindings
+install: install-perl-bindings
+endif
 
 clean:
        rm -f $(LIB) $(OBJECTS) $(LINKS) $(BINDINGS) $(BINDINGSRC)
index c1655cabf31a1bce741c3c1403fc5b75862bc687..19e46ad89695b544354655bd3024b73880081af7 100644 (file)
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-ifneq (,$(shell [ -e /usr/include/curses.h ] || echo no))
-all vm-top:
-       @echo "***********************************************************"
-       @echo "WARNING: Install ncurses to build vm-top."
-       @echo "***********************************************************"
-else
-
 XEN_ROOT=../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+ifneq ($(XENSTAT_VM_TOP),y)
+all install vm-top:
+else
+
 INSTALL         = install
 INSTALL_PROG    = $(INSTALL) -m0755 -D
 INSTALL_DATA    = $(INSTALL) -m0644 -D
@@ -36,12 +33,11 @@ all: vm-top
 
 vm-top: vm-top.o
 
-endif
-
 install: vm-top vm-top.1
-       [ -f vm-top ] && $(INSTALL_PROG) vm-top $(DESTDIR)$(sbindir)/vm-top
-       [ -f vm-top.1 ] && \
-           $(INSTALL_DATA) vm-top.1 $(DESTDIR)$(man1dir)/vm-top.1
+       $(INSTALL_PROG) vm-top $(DESTDIR)$(sbindir)/vm-top
+       $(INSTALL_DATA) vm-top.1 $(DESTDIR)$(man1dir)/vm-top.1
+
+endif
 
 clean:
        rm -f vm-top vm-top.o